﻿using System;
namespace Producers.Rr.Xtee.Riik.Ee.Producer.Rr {
    
    
    public class PersonalCode : global::Xtee.Core.Schema.XsdString {
        
        public PersonalCode(string value) : 
                base(value) {
            this.Pattern = @"[1,2,3,4,5,6][0-9]{2}((0[0-9])|(1[0-2]))(([0-2][0-9])|(3[0,1]))[0-9]{4}";
            this.Validate();
        }
        
        public PersonalCode() : 
                base(string.Empty) {
        }
        
        public static bool TryParse(string value, out global::Producers.Rr.Xtee.Riik.Ee.Producer.Rr.PersonalCode result) {
            try {
                result = new global::Producers.Rr.Xtee.Riik.Ee.Producer.Rr.PersonalCode(value);
                return true;
            }
            catch (System.Exception ) {
                result = null;
                return false;
            }
        }
        
        public static implicit operator String (PersonalCode value) {
            return value.Value;
        }
        
        public static implicit operator PersonalCode (string value) {
            if (value==null) {
                return null;
            }
            return new PersonalCode(value);
        }
    }
}
